package org.nanotek.mq.send;

import javax.jms.Destination;
import org.nanotek.cms.domain.message.BodyMessageContainer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;

@Component
public class MessageSenderService {

	private final JmsTemplate jmsTemplate;
    
    @Autowired
    private Destination destination; 
    
	 	@Autowired
	    public MessageSenderService( final JmsTemplate jmsTemplate )
	    {
	 		this.jmsTemplate = jmsTemplate;
	    }
	 	
	 	public void send(BodyMessageContainer message )
	    {
	        jmsTemplate.convertAndSend(destination , message);
	    }
	 	
}
